﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace AlbonWeb.Account
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                message.Text = "";
            }
            
        }

        protected void login_btn_Click(object sender, EventArgs e)
        {
            UserBLL userbll = new UserBLL();
            string ret=userbll.Login(loginName.Text.Trim(), loginPassword.Text.Trim());
            switch (ret)
            {
                case "Success": Response.Redirect("/Default.html"); break;
                case "No Match":
                case "No Data":
                case "No Cookies":
                    Response.Redirect("/Common/CheckCookie.aspx?cookieMessage=" + ret + "&loginname=" + loginName.Text.Trim());
                    break;
                default:
                    message.Text = ret;
                    loginPassword.Focus();
                    break;
            }
        }
    }
}